{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import tkinter as tk\n",
    "from tkinter import *\n",
    "from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg\n",
    "from matplotlib.figure import Figure\n",
    "from matplotlib import pyplot as plt\n",
    "import matplotlib.pyplot as plt\n",
    "from pandas import DataFrame\n",
    "import getpass\n",
    "#print(getpass.getuser())\n",
    "root=Tk()\n",
    "root.title('Retail Analytics')\n",
    "root.configure(bg='#ffffff')\n",
    "#root.attributes('-fullscreen',True)\n",
    "s_width = root.winfo_screenwidth()\n",
    "s_height = root.winfo_screenheight()\n",
    "root.geometry(\"%dx%d\" % (s_width, s_height))\n",
    "#root.geometry('1280x720+110+0')\n",
    "root.state('zoomed')\n",
    "\n",
    "\n",
    "upr_fr=Frame(root,cursor='arrow',relief=RIDGE,highlightthickness=2,bg='white',bd=2,width=s_width,height=120)\n",
    "upr_fr.place(x=10,y=-10)\n",
    "\n",
    "fr1=Frame(root,cursor='arrow',relief=RIDGE,bg='white',bd=2,width=230,height=120)\n",
    "fr1.place(x=290,y=170)\n",
    "\n",
    "fr2=Frame(root,cursor='arrow',relief=RIDGE,highlightthickness=2,bg='white',bd=2,width=230,height=120)\n",
    "fr2.place(x=550,y=170)\n",
    "\n",
    "fr3=Frame(root,cursor='arrow',relief=RIDGE,highlightthickness=2,bg='white',bd=2,width=230,height=120)\n",
    "fr3.place(x=800,y=170)\n",
    "\n",
    "fr4=Frame(root,cursor='arrow',relief=RIDGE,highlightthickness=2,bg='white',bd=2,width=230,height=120)\n",
    "fr4.place(x=1050,y=170)\n",
    "\n",
    "fr5=Frame(root,cursor='arrow',relief=RIDGE,highlightthickness=2,bg='white',bd=2,width=500,height=600)\n",
    "fr5.place(x=350,y=330)\n",
    "\n",
    "fr6=Frame(root,cursor='arrow',relief=RIDGE,highlightthickness=2,bg='white',bd=2,width=500,height=600)\n",
    "fr6.place(x=890,y=330)\n",
    "\n",
    "side_frame=Frame(root,cursor='arrow',relief=RIDGE,highlightthickness=2,bg='#2c343c',bd=2,width=270,height=1080)\n",
    "side_frame.place(x=-10,y=-100)\n",
    "Center_side_frame=Frame(root,cursor='arrow',relief=RIDGE,highlightthickness=2,bg='#2c343c',bd=2,width=270,height=1080)\n",
    "side_frame.place(x=-20,y=-100)\n",
    "\n",
    "\n",
    "fr1_Lbl_1=Label(fr1,relief=FLAT,bd=0,bg='white',fg='BLACK',font=(\"Segoe UI\",13),highlightthickness=0,text='Today\\'s Woking Hour')\n",
    "fr1_Lbl_1.place(x=25,y=8)\n",
    "\n",
    "#fr1_Lbl_1.configure(anchor='center')\n",
    "fr2_Lbl_1=Label(fr2,relief=FLAT,bd=0,bg='white',fg='BLACK',font=(\"Segoe UI\",13),highlightthickness=0,text='Weekly Woking Hour')\n",
    "fr2_Lbl_1.place(x=15,y=2)\n",
    "\n",
    "fr3_Lbl_1=Label(fr3,relief=FLAT,bd=0,bg='white',fg='BLACK',font=(\"Segoe UI\",13),highlightthickness=0,text='Monthly Woking Hour')\n",
    "fr3_Lbl_1.place(x=10,y=2)\n",
    "\n",
    "fr4_Lbl_1=Label(fr4,relief=FLAT,bd=0,bg='white',fg='BLACK',font=(\"Segoe UI\",13),highlightthickness=0,text='Shfit Details')\n",
    "fr4_Lbl_1.place(x=40,y=2)\n",
    "\n",
    "\n",
    "\n",
    "#upr Frame codes\n",
    "fr1_Lbl_1=Label(upr_fr,relief=FLAT,bd=0,bg='white',fg='BLACK',font=(\"Segoe UI\",13),highlightthickness=0,text='Hello, %s'%(getpass.getuser()))\n",
    "fr1_Lbl_1.place(x=s_width-300,y=20)\n",
    "\n",
    "fr1_Lbl_2=Label(upr_fr,cursor='hand2',relief=RIDGE,bd=0,bg='white',fg='Red',font=(\"Segoe UI\",13),highlightthickness=0,text='Logout')\n",
    "fr1_Lbl_2.place(x=s_width-150,y=20)\n",
    "\n",
    "fr1_Lbl_3=Label(upr_fr,relief=FLAT,bd=0,bg='white',fg='BLACK',font=(\"Segoe UI\",20,'bold'),highlightthickness=0,text='Dashboard of Phone Quality')\n",
    "fr1_Lbl_3.place(x=350,y=50)\n",
    "\n",
    "# fr1_Lbl_4=Label(upr_fr,relief=FLAT,bd=0,bg='white',fg='BLACK',font=(\"Segoe UI\",13,'italic'),highlightthickness=0,text='MCA Intern')\n",
    "# fr1_Lbl_4.place(x=550,y=62)\n",
    "\n",
    "# fr1_Lbl_4=Label(upr_fr,relief=FLAT,bd=0,bg='white',fg='BLACK',font=(\"Segoe UI\",13),highlightthickness=0,text='AnupGaurav@exlservice.com')\n",
    "# fr1_Lbl_4.place(x=350,y=85)\n",
    "\n",
    "\n",
    "#define create charts\n",
    "\n",
    "def create_charts():\n",
    "    \n",
    "\n",
    "    data1={'Working_Days':('2020-04-01','2020-04-02','2020-04-03','2020-04-05','2020-04-06'),\n",
    "          'Production_Hour':[8.33,7.12,6.14,7.99,7.19]}\n",
    "    \n",
    "  \n",
    "    df1 = DataFrame(data1,columns=['Working_Days','Production_Hour'])\n",
    "    \n",
    "    \n",
    "    data2={'Working_Days':('2020-04-01','2020-04-02','2020-04-03','2020-04-05','2020-04-06'),\n",
    "          'Production_Hour':[8.33,7.12,6.14,7.99,7.19]}\n",
    "    \n",
    "    df2 = DataFrame(data2,columns=['Working_Days','Production_Hour'])\n",
    "    \n",
    "    \n",
    "    figure1 = plt.Figure(figsize=(5,4), dpi=100)\n",
    "    ax1 = figure1.add_subplot(111)\n",
    "    bar1 = FigureCanvasTkAgg(figure1,fr5)\n",
    "    bar1.get_tk_widget().pack(side=tk.BOTTOM, fill=tk.BOTH)\n",
    "    df1 = df1[['Working_Days','Production_Hour']].groupby('Working_Days').sum()\n",
    "    df1.plot(kind='bar', legend=True, ax=ax1)\n",
    "    ax1.axhline(y=8,linewidth=2,color='g')\n",
    "    ax1.set_title('Working_Days Vs. Production_hour')\n",
    "\n",
    "    \n",
    "    figure2 = plt.Figure(figsize=(5,4), dpi=100)\n",
    "    ax2 = figure2.add_subplot(111)\n",
    "    line2 = FigureCanvasTkAgg(figure2,fr6)\n",
    "    line2.get_tk_widget().pack(side=tk.RIGHT, fill=tk.BOTH)\n",
    "    df2 = df2[['Working_Days','Production_Hour']].groupby('Working_Days').sum()\n",
    "    df2.plot(kind='line', legend=True, ax=ax2, color='r',marker='o', fontsize=10)\n",
    "    ax2.set_title('Working_Days Vs. Production_hour')\n",
    "\n",
    "\n",
    "    \n",
    "#end of define create_charts\n",
    "\n",
    "\n",
    "\n",
    "#side frAME CODES\n",
    "fr1_L=Label(side_frame,text='  Employee Time \\n Tracking',justify='center',fg='#40E0D0',bg='#2c343c',relief=FLAT,height=2,width=13,font=(\"Arial\",23,'bold'))\n",
    "fr1_L.place(x=5,y=120)\n",
    "\n",
    "sfr_Btn_1=Button(side_frame,cursor='hand2',command=create_charts,relief=FLAT,bg='white',height=1,width=23,text='Your Dashboard',font=(\"Segoe UI\",14)) \n",
    "sfr_Btn_1.place(x=5,y=350)\n",
    "\n",
    "sfr_Btn_1=Button(side_frame,cursor='hand2',relief=FLAT,bg='white',height=1,width=23,text='Others Dashboard',font=(\"Segoe UI\",14))\n",
    "sfr_Btn_1.place(x=1,y=395)\n",
    "\n",
    "sfr_Btn_1=Button(side_frame,cursor='hand2',relief=FLAT,bg='white',height=1,width=23,text='Send Request',font=(\"Segoe UI\",14))\n",
    "sfr_Btn_1.place(x=1,y=440)\n",
    "\n",
    "\n",
    "  \n",
    "# Resizing image to fit on button \n",
    "#photoimage = photo.subsample(3, 3) \n",
    "#sfr_Btn_1=Button(side_frame,cursor='hand2',relief=FLAT,bg='white',height=1,width=23, image = photoimage,compound = LEFT,text='Send Request',font=(\"Segoe UI\",14))\n",
    "#sfr_Btn_1.place(x=1,y=390)\n",
    "\n",
    "root.mainloop()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
